<?php

class Agency {

    public function ListBanks($BankID,$FieldName,$CountryID) {
        $MDAC = 'ED';
        $ACBank = "select bp_ID as ID, concat(lpad(bp_IdBanco,4,'0'),' | ',bp_Name,'') as NAME
		from hd_bancos
		where (bp_Flag = 2 or bp_ID = $BankID)
		and hd_bancos.bp_Country = $CountryID";
//echo $ACBank;

        $Label = $GLOBALS['MYT']->db_array($ACBank);


        if ($MDAC == 'RD') {
            $Label = $GLOBALS['MYT']->db_array("SELECT bp_Name AS NAME FROM hd_bancos
								WHERE bp_ID = $BankID");
            $Label = $Label[1]['NAME'];
        } else {
            $Label = ' ';
        }
        return rt_field('select', $MDAC, $FieldName, $BankID, $ACBank, $Label, '', '');
    }

    public function BankAgency() {

        if (!isset($s)) {
            $s = 1;
            $Account[$s]['cb_CiudadSucursal'] = '';
        }
        if (isset($_GET['MD'])) {
            $MDAC = $_GET['MD'];
            $Account[$s]['cb_Banco'] = $_GET['FBID'];
            $Account[$s]['cb_CiudadSucursal'] = $_GET['FLID'];
            $Account[$s]['cb_Sucursal'] = $_GET['FAID'];
        }

        $ACGEOLOC = "SELECT bps_Ciudad AS ID, bps_Ciudad AS NAME FROM hd_dessucursales 
				WHERE bps_Banco = {$Account[$s]['cb_Banco']}
				GROUP BY bps_Ciudad
				ORDER BY bps_Ciudad";
        if ($MDAC == 'RD') {
            $Label = $MYT->db_array("SELECT bps_Ciudad AS NAME FROM hd_dessucursales
								WHERE bps_Ciudad = {$Account[$s]['cb_CiudadSucursal']}");
            $Label = $Label[1]['NAME'];
        } else {
            $Label = '';
        }
        mn_field('select', $MDAC, 'cb_CiudadSucursal', $Account[$s]['cb_CiudadSucursal'], $ACGEOLOC, $Label, 'False', '"onChange="replaceUrl(\'fina\',\'Modules/Fin/fina.mex?FBID=\'+document.getElementById(\'cb_Banco\').value+\'&FLID=\'+document.getElementById(\'cb_CiudadSucursal\').value+\'&FAID=\'+document.getElementById(\'cb_Sucursal\').value+\'&MD=' . $MDAC . '\');');
    }

    public function ReceiverAgency($AgencyID, $FieldName) {
        $MDAC = 'ED';
        if ($AgencyID < 1) {
            $AgencyID = '';
        }
        /*
          if (isset($_GET['MD'])) {
          $MDAC = $_GET['MD'];
          $GET[1]['cb_Banco'] = $_GET['FBID'];
          $GET[1]['cb_CiudadSucursal'] = $_GET['FLID'];
          $GET[1]['cb_Sucursal'] = $_GET['FAID'];
          }

          $ACAgency = "SELECT bps_ID AS ID, bps_Agencia AS NAME FROM hd_dessucursales
          WHERE bps_Banco = {$GET[1]['cb_Banco']} AND bps_Ciudad =

          '{$GET[1]['cb_CiudadSucursal']}'";
          if($MDAC == 'RD') {
          $Label = $MYT->db_array("SELECT bps_Agencia AS NAME FROM hd_dessucursales
          WHERE bps_ID = {$GET[1]['cb_CiudadSucursal']}");
          $Label = $Label[1]['NAME'];
          } else {
          $Label = '';
          }
          mn_field('select',$MDAC,'cb_Sucursal',$GET[1]['cb_Sucursal'],$ACAgency,$Label,'',''); */
        mn_field('text', $MDAC, $FieldName, $AgencyID, '8', '5', '', '');
    }

}

?>
